<!DOCTYPE HTML>
<html lang="utf-8">
<head>
<meta charset="utf-8">
<title>驾车宝典-注册</title>
<link href="${ctx}/styles/group.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/user.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/loginNReg.css" rel="stylesheet" type="text/css">
<#include '/baseHead.ftl'>
<!--主要部分开始-->
<section id="main"><div class="bgA_01">
	
	<div class="loginNRegPanel_01">
		<div class="formField">
			<nav class="menu">
				<ul>
					<li><a class="on" href="#" title="点击注册">创建踏客帐号</a></li>
					<li><a href="#" title="点击登录">我已有踏客帐号</a></li>
				</ul>
			</nav>
			<div class="list">
				<ul>
					<li class="id"><input type="text" class="txt" id="loginName" placeholder='登录名登录名登录名登录名登录名'></li>
					<li class="id"><input type="text" class="txt" id="nickName" placeholder='昵称昵称昵称昵称昵称昵称昵称昵称'></li>
					<li class="pw"><input type="password" class="txt"  id="password"></li>
					<li class="pw"><input type="password" class="txt"  placholder="重复密码" id="repassword"></li>
					<li class="text"><em>* 密码长度为6-20位</em></li>
					<li><input type="button" value="发送验证码" onclick="getVerifyCode();">
					<input type="text" value="" placeholder="输入登录名昵称密码后获取验证码" id="verifyCode">
					</li>
					<!--<li class="dm"><input type="text" class="txt" value="">
					<span>.ddlife.com</span></li>-->
				</ul>
			</div>
			<!--
			<div class="checks">
				<input type="checkbox" class="check" name="job" id="job_1">
				<label for="job_1">我在工作</label>
				<input type="checkbox" class="check" name="job" id="job_2">
				<label for="job_2">我在上学</label>
				<input type="checkbox" class="check" name="job" id="job_3">
				<label for="job_3">其它</label>
			</div>
			-->
			<div class="btns">
				<button class="btn btn1" title="点击注册" onclick='reg();'>注册</button>
			</div>
		</div>
		<div class="btnField">
			<ul>
				<li><a href="#" class="btn btn1" title="用微博帐号登录">用微博帐号登录</a></li>
				<!--
				<li><a href="#" class="btn btn2" title="用QQ帐号登录">用QQ帐号登录</a></li>
				<li><a href="#" class="btn btn3" title="用豆瓣帐号登录">用豆瓣帐号登录</a></li>
				<li><a href="#" class="btn btn4" title="用人人帐号登录">用人人帐号登录</a></li>
				<li><a href="#" class="btn btn5" title="用腾讯微博帐号登录">用腾讯微博帐号登录</a></li>
				<li><a href="#" class="btn btn6" title="用MSN帐号登录">用MSN帐号登录</a></li>
				-->
			</ul>
		</div>
	</div>
		

</div></section>
<!--主要部分结束-->
<!--主要部分结束-->
<#include '/baseFoot.ftl'>
<script>
	function getVerifyCode(){
		if ( $('#loginName').val()  == "" ){
			alert("请输入手机或者邮箱作为登录名");
			return ;
		}
		if ( $('#nickName').val()  == "" ){
			alert("请输入昵称");
			return ;
		}
		if ( $('#password').val()  == "" ){
			alert("请输入密码");
				return ;
		}
		if ( $('#repassword').val()  == "" ){
			alert("请重复密码");
				return ;
		}
		if (  $('#password').val()  != $('#repassword').val()   ) {
			alert("两次密码输入不一致");
			return ;
		}
		$.ajax({
		 			type: "get",
					url: "${ctx}/member/getverifycode",
					beforeSend: function(XMLHttpRequest){
					//ShowLoading();
					},
					success: function(data, textStatus){
						if ( data.state == 1){
							alert("验证码已发送,请查看");
						}else{
							alert(data.desc);
						}
					},
					data:{
						nickName:$('#nickName').val() ,
						loginName:$('#loginName').val() ,
						password:$('#password').val() 
					},
					dataType:'json'
				}
	 		)
	}
	function reg(){
		if ( $('#loginName').val()  == "" ){
			alert("请输入手机或者邮箱作为登录名");
			return ;
		}
		if ( $('#nickName').val()  == "" ){
			alert("请输入昵称");
			return ;
		}
		if ( $('#password').val()  == "" ){
			alert("请输入密码");
				return ;
		}
		if ( $('#repassword').val()  == "" ){
			alert("请重复密码");
				return ;
		}
		if (  $('#password').val()  != $('#repassword').val()   ) {
			alert("两次密码输入不一致");
			return ;
		}
		if ( $('#verifyCode').val()  == "" ){
			alert("请输入验证码");
				return ;
		}
		$.ajax({
		 			type: "get",
					url: "${ctx}/member/reg",
					beforeSend: function(XMLHttpRequest){
					//ShowLoading();
					},
					success: function(data, textStatus){
						if ( data.state == 1){
							alert("注册成功");
							window.location.href = "${ctx}/21";
						}else{
							alert(data.desc);
						}
					},
					data:{
						nickName:$('#nickName').val() ,
						loginName:$('#loginName').val() ,
						password:$('#password').val() ,
						verifyCode:$('#verifyCode').val()
					},
					dataType:'json'
				}
	 		)
	}
</script>
</body>
</html>